import { ref } from 'vue';

export const books = ref([]);

export async function getBooks_by_write(id,proxy) {
    try {
      const response = await proxy.$http.get(`/api/book/author?author_id=${id}`);
      // 检查响应的实际结构
      if (response.data && response.data.data && response.data.data.book) {
        books.value = response.data.data.book;
        
      }
      else
        console.error(response);
    } catch (error) {
      console.error(`Error fetching books:`, error);
    }
}
